package com.honglang.module.user.action;

import java.util.Map;

import org.apache.struts2.ServletActionContext;

import com.honglang.common.tools.Constants;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class UserOperatorInterceptor  extends AbstractInterceptor {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public String intercept(ActionInvocation invocation) throws Exception{
		   
		   Map<?, ?> session=invocation.getInvocationContext().getSession();
		   String username=(String) session.get(Constants.USERNAME_KEY);
		   String quickLogin =	ServletActionContext.getRequest().getParameter("quickLogin");
		   if(null != quickLogin && quickLogin.equals("true")){
			   return invocation.invoke();
		   }
		   if(null!= username && !username.equals("")){
			   return invocation.invoke();
		   }
		   else{
			   return "userLogin";
		   }
		   
	 }
}
